import request from '@/utils/request'

// 查询VIP配置列表
export function listVipConfig(query) {
  return request({
    url: '/vip/payment/config/list',
    method: 'get',
    params: query
  })
}

// 创建VIP支付订单
export function createVipOrder(data) {
  return request({
    url: '/vip/payment/create',
    method: 'post',
    data: data
  })
}

// VIP订单支付
export function vipOrderPay(data) {
  return request({
    url: '/vip/payment/pay',
    method: 'post',
    data: data
  })
}

// 查询VIP订单列表
export function listVipOrder(query) {
  return request({
    url: '/vip/payment/order/list',
    method: 'get',
    params: query
  })
}

// 查询VIP订单详细
export function getVipOrder(id) {
  return request({
    url: '/vip/payment/order/' + id,
    method: 'get'
  })
}

// 根据订单号查询VIP订单
export function getVipOrderByOrderSn(orderSn) {
  return request({
    url: '/vip/payment/order/sn/' + orderSn,
    method: 'get'
  })
}

// 根据用户ID查询VIP订单列表
export function getVipOrderByUserId(userId) {
  return request({
    url: '/vip/payment/order/user/' + userId,
    method: 'get'
  })
}

// 新增VIP订单
export function addVipOrder(data) {
  return request({
    url: '/vip/payment/order',
    method: 'post',
    data: data
  })
}

// 修改VIP订单
export function updateVipOrder(data) {
  return request({
    url: '/vip/payment/order',
    method: 'put',
    data: data
  })
}

// 删除VIP订单
export function delVipOrder(id) {
  return request({
    url: '/vip/payment/order/' + id,
    method: 'delete'
  })
}

// 取消VIP订单
export function cancelVipOrder(orderSn) {
  return request({
    url: '/vip/payment/order/cancel/' + orderSn,
    method: 'post'
  })
}

// 支付成功回调
export function paySuccessCallback(data) {
  return request({
    url: '/vip/payment/callback',
    method: 'post',
    data: data
  })
}

// 查询用户VIP状态
export function getUserVipStatus(userId) {
  return request({
    url: '/vip/payment/user/' + userId + '/status',
    method: 'get'
  })
}

// 导出VIP订单
export function exportVipOrder(query) {
  return request({
    url: '/vip/payment/order/export',
    method: 'post',
    params: query
  })
}